package com.itcase.interfacedemo.Demo02;

import java.util.ArrayList;

/*
要写注释哦!!!
*/
public class StudentManagerImpl2 extends StudentManageFather implements StudentManager{
    @Override
    public void showInfo() {
        int girlCount=0;
        int manCount=0;
        for (int i = 0; i < students.size(); i++) {
            Student student = students.get(i);
            System.out.println("姓名:"+student.getName()+"\t性别:"+student.getGender()+"\t成绩:"+student.getAcore());
            if (student.getGender().equals("男")){
                manCount++;
            }else {
                girlCount++;
            }
        }
        System.out.println("男生为："+manCount+"，女士为："+girlCount);
    }

    @Override
    public void showInfoByScore() {
        int sum=0;
        int max=students.get(0).getAcore();
        int min=students.get(0).getAcore();
        for (int i = 0; i < students.size(); i++) {
            Student student = students.get(i);
            if (student.getAcore()>max){
                max=student.getAcore();
            }
            if (student.getAcore()<min){
                min=student.getAcore();
            }
            sum+=student.getAcore();
        }
        System.out.println("平均成绩为："+(sum-min-max)*1.0/(students.size()-2));
    }
}
